﻿
using SIG.Model;
using SIG.Model.Identity;
using System.Data.Entity;

namespace SIG.Data.UnitOfWork 
{
    public class MainBCUnitOfWorkInitializer : DropCreateDatabaseAlways<MainBCUnitOfWork>
    {
        protected override void Seed(MainBCUnitOfWork unitOfWork)
        {
            InitialMemorySet initialMemorySet = new InitialMemorySet();
            foreach (Category entity in initialMemorySet.Categories)
                unitOfWork.Categories.Add(entity);
            foreach (Menu entity in initialMemorySet.Menus)
                unitOfWork.Menus.Add(entity);
            foreach (Log entity in initialMemorySet.Logs)
                unitOfWork.Logs.Add(entity);
            foreach (Role entity in initialMemorySet.Roles)
                unitOfWork.Roles.Add(entity);
            foreach (User entity in initialMemorySet.Users)
                unitOfWork.Users.Add(entity);
        
            unitOfWork.Commit();
        }
    }
}
